<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>农技电子杂志订阅</title>
		<link href="__CSS__/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="__CSS__/iconfont.css" />
		<link rel="stylesheet" href="__CSS__/style.css" />
		<link rel="stylesheet" href="__CSS__/mall.css" />
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-icon mui-icon-left-nav mui-pull-left" onclick='window.location.href="{:url('member/index')}"'></a>
			<h1 class="mui-title">农技电子杂志订阅</h1>
		</header>
		<div class="mui-content">
			<div class="gerenzl_nr">
				<form id="myForm" class="mui-input-group gerenzl_group">
					<div class="mui-input-row">
						<b style="color: red;">从即日起至2018-3-30期间免费订阅！</b>
					</div>
					<div class="ordpj_listbox">
						<div class="ordpj_lisitem">
							<label><input type="radio" name="user_type" value="2" checked="checked"> 限时免费
								<del style="margin-left: 50px; color: red;">原价60元/3月</del></label>
						</div>
					</div>
					<h1 style="font-size: 18px;padding: 10px;">分类</h1> {foreach name='cate' item='vo'}
					<div class="mui-input-row">
						<span style="border: #009900 1px solid;color: #009900;padding:0 3px; margin-right: 8px;">
							<input type="checkbox" name="yuetype1[]" onclick="checkAll('{$vo.id}')" class="fanss{$vo.id}" id="fanss{$vo.id}" value="{$vo.id}" {if in_array($vo.id,$user.yuetype1)}checked{/if}/>
							<label for="fanss{$vo.id}" style="float: inherit;height: 30px;line-height: 30px;">{$vo.name}</label>
						</span> 
						{foreach name='vo.note' item='vo2'}
						<div style="display: inline-block;margin-right: 15px; ">
							<input type="checkbox" name="yuetype[]" id="fans{$vo2.id}" onclick="bb('{$vo.id}')" class="fans{$vo.id}" value="{$vo2.id}" {if in_array($vo2.id,$user.yuetype)}checked{/if}/>
							<label for="fans{$vo2.id}" style="float: inherit;height: 30px;line-height: 30px;">{$vo2.name}</label>
						</div>
						{/foreach}
					</div>
					{/foreach}
					<div class="ordpj_nrbox" style="padding-bottom: 30px;">
						<div class="ordpj_scimg clearfix">
							<div class="bt">会员福利：</div>
							<div class="ordpj_imgbox">
								1、享受普通会员一切福利<br> 2、年费会员享受免费一次产品品牌包装服务
								<br> 3、年费会员享受统一对外销售服务
								<br> 4、年费会员免费享受一次项目申报拟写文件服务
								<br> 5、免费查询周边农民工信息服务
								<br> 6、免费享受专家在线技术指导服务
								<br> 7、免费享受农业情报站最新情报信息推送服务（市场行情情报、政策情报、技术情报、生活信息）
							</div>
						</div>
						<button type="submit" class="fjysq_sbtn">确定订阅</button>
					</div>
				</form>
			</div>
		</div>
	</body>

</html>
<script src="__JS__/jquery.min.js"></script>
<script src="__JS__/jquery.validate.min.js"></script>
<script src="__JS__/mui.min.js"></script>
<script src="__LIB__/layer.js"></script>
<script src="__JS__/index.js"></script>
<script src="__JS__/image.zip.js"></script>
<script type="text/javascript">
	function checkAll($id) {
        //触发事件对象，全选的checkbox
        var obj = event.srcElement;
        //所有的input标签
        var inputs = document.getElementsByClassName('fans'+$id);
        for (var i = 0; i < inputs.length; i++) {
            //判断当前的对象是不是input对象，是不是checkbox
            if (inputs[i].type == "checkbox") {
                inputs[i].checked = obj.checked;
            }
        }
    }
	function bb($id){
	 document.getElementById('fanss'+$id).checked=true;
	}

	
	$(function() {
		$("#myForm").validate({
			focusInvalid: true,
			onkeyup: false,
			ignore: "",
			onfocusout: false,
			showErrors: function(errorMap, errorList) {
				var msg = "";
				if(errorList != null && errorList != "") {
					msg = errorList[0]['message'];
					layer.msg(msg);
				}
			},
			submitHandler: function(form) { //表单提交句柄,为一回调函数，带一个参数：form   
				// ajax提交
				app.ajax();
			},
			rules: {
				'yuetype[]': {
					required: true
				}
			},
			messages: {
				'yuetype[]': {
					required: "请至少选择一个栏目"
				}
			}
		});
	});
</script>